﻿namespace K9Nano.Dependency;

public interface IIocHelper
{
    bool IsRegister<T>() => IsRegister(typeof(T));
    bool IsRegister(Type type);

    IEnumerable<Type> GetRegisteredTypes(Func<Type, bool> filter);

    IEnumerable<Type> GetRegisteredTypes<TBase>()
    {
        var baseType = typeof(TBase);
        return GetRegisteredTypes(type => type.IsSubclassOf(baseType) || baseType.IsAssignableFrom(type));
    }
}
